package cn.yunbamboos.media.zlm.client.result;

import cn.yunbamboos.media.zlm.client.result.data.IResultData;

public class GenericResult<T extends IResultData> implements IResult<T> {

    private final int code;
    private final String msg;
    private T data;

    public GenericResult(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public GenericResult(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    @Override
    public T getData() {
        return data;
    }

    @Override
    public boolean isSuccess() {
        return code == 0;
    }

    public String getMsg() {
        return msg;
    }
}
